/**
 * @file app\tasks\mobus\devices\_ack.c
 *
 * Copyright (C) 2023
 *
 * _ack.c is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @author HinsShum hinsshum@qq.com
 *
 * @encoding utf-8
 */

/*---------- includes ----------*/
/*---------- macro ----------*/
/*---------- type define ----------*/
/*---------- variable prototype ----------*/
/*---------- function prototype ----------*/
/*---------- variable ----------*/
/*---------- function ----------*/
static void _ack(mobus_device_t self, mobus_frame_type_t type,
    mobus_ack_result_t result) {
    static bool first_power_on = true;

    if (type == MOBUS_FRAME_TYPE_LOGIN) {
        if (result == MOBUS_ACK_SYNC) {
          //self->_req_access_to_network(self);
        }
        else {
            self->login = MOBUS_LOGGED_IN;
            if (first_power_on) {
                first_power_on = false;
                self->report_information(self, 0);
            }
        }
    }
}
